using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using WPFExcelReport.Helpers;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{

    public partial class VICC_WFEVENTS
    {
        private void EMYGRVKPOS001(DataRow dwInput, string events = "MYGRVKPOS001", string msg = "", MessageInfo msgs = null)
        {
            try
            {
                if (msgs == null)
                    return;
                DataRow dwData = null;
                dwData = TBMain.NewRow();
                SetUpNewRow(ref dwData);
                dwData["ROWNID"] = 0;
                dwData["MANDANT"] = app.Mandant;
                dwData["WFEVENTS"] = Helper.Left(events.PadRight(20), 20);
                dwData["WFWHEN"] = System.DateTime.Now;
                dwData["ORDTYPE"] = "K";
                dwData["KRS"] = dwInput["VKPAUFKRS"];
                dwData["LFD"] = dwInput["VKPAUFLFD"];
                dwData["POS"] = dwInput["VKPAUFPOS"];
                string userid = msgs.Where;

                DataRow dwEvents = null;
                var qHander = from DataRow row in this.TbEventdef.AsEnumerable()
                              where row["WFEVENTS"].ToString().Trim() == events
                              select row;
                foreach (DataRow row in qHander)
                {
                    dwEvents = row;
                }
                var qUsers = from DataRow row in TbScriber.AsEnumerable()
                             where row["WFEVENTS"].ToString().Trim() == events
                             select row;
                foreach (DataRow row in qUsers)
                {
                    dwData["USERGROUP"] = row["USERGROUP"];
                    dwData["WFEUSER"] = row["WFEUSER"];
                    dwData["WFEHANDLER"] = dwEvents["WFEHANDLER"];
                    dwData["WHAT"] = Helper.Left(msg.PadRight(800), 800);
                    dwData["NEWUSER"] = userid;
                    dwData["NEWTIME"] = DateTime.Now.ToLocalTime().ToString();
                    DataRow dwWF = INTEXDBC.SaveICC_WFEVENTS(dwData);
                    //FireEvent(dwWF);
                }
            }
            catch (Exception ex)
            {

            }
        }


    }
}
